//tcp.h
#pragma once
#include "../include/commondef.h"

//TCP标志//[
#define TCP_CTRLBITS_
#define TCP_CTRLBITS_URG 0x20
#define TCP_CTRLBITS_ACK 0x10
#define TCP_CTRLBITS_PSH 0x08
#define TCP_CTRLBITS_RST 0x04
#define TCP_CTRLBITS_SYN 0x02
#define TCP_CTRLBITS_FIN 0x01
//]
//TCP端口//[
#define TCP_PORT_
#define TCP_PORT_HTTP	80
#define TCP_PORT_HTTPS	443
#define TCP_PORT_IMAP	143
#define TCP_PORT_SMTP	25
#define TCP_PORT_POP3	110
//]
#pragma pack(1)
//TCP首部//[
typedef struct _TCP_HEADER{
	U16 u16_SrcPort;	//源端口(16 bits)                       
	U16 u16_DstPort;	//目的端口(16 bits)                       
	U32 u32_SeqNum;		// Sequence Number (32 bits)    
	U32 u32_AckNum;		// Acknowledgment Number (32 bits)  
	U8 u8_HdrLen;		//高4位为首部长度，单位是4字节，低4位保留。
	U8 u8_CtrlBits;		//高2位保留，低6位为标志位，其值为一个或多个TCP_CTRLBITS_的或。
	U16 u16_Window;		//窗口大小(16 bits)
	U16 u16_Checksum;	//效验和(16 bits)
	U16 u16_Urgent;		//紧急指针(16 bits)
}TCP_HEADER;
//]
#pragma pack()